import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import axios from 'axios'

// 白名单针对的是route 路由 拦截器拦截的是axios
//设置白名单
// router.beforeEach((to, from, next) => {
//     let white = ["/clogin"]
//     let pathlist = JSON.parse(localStorage.getItem("pagelist"))
//     if (pathlist) {
//         for (var i = 0; i < pathlist.length; i++) {
//             white.push(pathlist[i])
//         }
//         if (white.includes(to.path)) {
//             next()
//         } else {
//             alert("您没有权限")
//         }
//     } else {
//         if (white.includes(to.path)) {
//             next()
//         } else {
//             alert("您没有权限")
//         }
//     }
// })


// // axios 拦截器
// axios.interceptors.request.use(config => {
//     let token = localStorage.getItem("token")
//     if (token) {
//         config.headers.Authorization = token
//     }
//     return config
// }, error => {
//     router.push("/clogin")
//     return Promise.reject(error)
// })







const app = createApp(App)
app.use(store)
app.use(router)

// import axios from 'axios'
// axios.defaults.baseURL = "http://127.0.0.1:5000/"
// Vue.prototype.$axios = axios


//vant
import Vant from 'vant';
import 'vant/lib/index.css';
app.use(Vant);

//element
import element from 'element-plus'
import 'element-plus/theme-chalk/index.css';
app.use(element)






app.mount("#app");